import request from "@/utils/request";

export function getProducts(paramters) {
  return request({
    url: "api/v1/products",
    method: "get",
    params: paramters,
    basicDataServer: true,
  });
}

export function getProduct(id) {
  return request({
    url: "api/v1/products/"+id,
    method: "get",
    basicDataServer: true,
  });
}

export function addProduct(data) {
  return request({
    url: "api/v1/products",
    method: "post",
    data: data,
    basicDataServer: true,
  });
}

export function updateProduct(data) {
  return request({
    url: "api/v1/products",
    method: "put",
    data: data,
    basicDataServer: true,
  });
}

export function deleteProduct(id) {
  return request({
    url: "api/v1/products/" + id,
    method: "delete",
    basicDataServer: true,
  });
}

export function getProductAuxiliaryUnits(paramters) {
  return request({
    url: "api/v1/products/auxiliary-units",
    method: "get",
    params: paramters,
    basicDataServer: true,
  });
}

export function getProductAuxiliaryUnit(id) {
  return request({
    url: "api/v1/products/auxiliary-units/"+id,
    method: "get",
    basicDataServer: true,
  });
}

export function addProductAuxiliaryUnit(data) {
  return request({
    url: "api/v1/products/auxiliary-units",
    method: "post",
    data: data,
    basicDataServer: true,
  });
}

export function updateProductAuxiliaryUnit(data) {
  return request({
    url: "api/v1/products/auxiliary-units",
    method: "put",
    data: data,
    basicDataServer: true,
  });
}

export function deleteProductAuxiliaryUnit(id) {
  return request({
    url: "api/v1/products/auxiliary-units" + id,
    method: "delete",
    basicDataServer: true,
  });
}

export function getProductPurchase(productId) {
  return request({
    url: "api/v1/products/purchase-settings/"+productId,
    method: "get",
    businessServer: true,
  });
}

export function addProductPurchase(data) {
  return request({
    url: "api/v1/products/purchase-settings/",
    method: "post",
    data: data,
    businessServer: true,
  });
}

export function updateProductPurchase(data) {
  return request({
    url: "api/v1/products/purchase-settings/",
    method: "put",
    data: data,
    businessServer: true,
  });
}

export function getProductInventory(productId) {
  return request({
    url: "api/v1/products/inventory-settings/"+productId,
    method: "get",
    businessServer: true,
  });
}

export function addProductInventory(data) {
  return request({
    url: "api/v1/products/inventory-settings/",
    method: "post",
    data: data,
    businessServer: true,
  });
}

export function updateProductInventory(data) {
  return request({
    url: "api/v1/products/inventory-settings/",
    method: "put",
    data: data,
    businessServer: true,
  });
}